import request from "../utils/request";

export const getAllCategories = (currentPage, size, id) => {
  return request.connection("get", `/category/categories`, {
    currentPage: currentPage,
    size: size,
    id: id,
  });
};

export const getAll = (id) => {
  return request.connection("get", `/category/getAll/${id}`);
};

export const updateCategory = (data) => {
  return request.connection("put", `/category/update`, data);
};

export const deleteCategory = (id) => {
  return request.connection("put", `/category/delete/${id}`);
};

export const recoverCategory = (id) => {
  return request.connection("put", `/category/recover/${id}`);
};

export const addCategory = (data) => {
  return request.connection("post", `/category/add`, data);
};

export const searchCategory = (currentPage, size, name, id) => {
  return request.connection("get", `/category/search`, {
    currentPage: currentPage,
    size: size,
    name: name,
    id: id,
  });
};

export const countCategories = (id) => {
  return request.connection("get", `/category/countCategories/${id}`);
};
